export function oss() {
  // @ts-ignore
  const env = import.meta.env;
    return {
      region: "us-east-1", // 区域可更改
      endpoint: "http://127.0.0.1:9000",
      credentials: {
        accessKeyId: "minioadmin",
        secretAccessKey: "minioadmin",
      },
      maxAttempts: 3,
      requestHandler: {
        connectionTimeout: 2000,
      },
    };
}

export function Bucket() {
  // @ts-ignore
  const env = import.meta.env;
  if (env.VITE_APP_OSS === "aliyun") {
    return "xuelang5t";
  }
  if (env.VITE_APP_OSS === "local") {
    return "d3-engine";
  }
  if (env.VITE_APP_OSS === "lvqu") {
    return "d3-engine";
  }
  return "test";
}

export enum MeshEditSignal {
  MESH_EDIT_FILL_HOLE = "mesh_edit_fill_hole",
  MESH_EDIT_REMOVE_PENETRATION = "mesh_edit_remove_penetration",
  MESH_EDIT_SPLIT = "mesh_edit_split",
  MESH_EDIT_SWAP = "mesh_edit_swap",
  MESH_EDIT_MORE = "mesh_edit_more",
  MESH_EDIT_STRETCH = "mesh_edit_stretch",
  MESH_EDIT_SWEEP = "mesh_edit_sweep",
}

export enum FloatMenuSignal {
  MESH_HIDE_ALL = "mesh_hide_all",
  MESH_SHOW_ALL = "mesh_show_all",
  GEO_POINT_MODE = "geo_point_mode",
  GEO_LINE_MODE = "geo_line_mode",
  GEO_FACE_MODE = "geo_face_mode",
  MESH_POINT_MODE = "mesh_point_mode",
  MESH_LINE_MODE = "mesh_line_mode",
  MESH_CELL_MODE = "mesh_cell_mode",
  VIEW_FACE_MODE = "view_face_mode",
  VIEW_LINE_MODE = "view_line_mode",
  VIEW_POINT_MODE = "view_point_mode",
}

export enum AppEvent {
  // * 模型库列表模型被选择
  MODEL_LIBRARY_SELECTED = "MODEL_LIBRARY_SELECTED",
  // * 结果库列表模型被选择
  RESULT_LIBRARY_SELECTED = "RESULT_LIBRARY_SELECTED",
}

// * 对应 网格编辑
export const meshEditToolMenu = [
  {
    label: "填孔",
    icon: "",
    clickSignal: MeshEditSignal.MESH_EDIT_FILL_HOLE,
  },
  {
    label: "移除穿透",
    icon: "",
    clickSignal: MeshEditSignal.MESH_EDIT_REMOVE_PENETRATION,
  },
  {
    label: "分割",
    icon: "",
    clickSignal: MeshEditSignal.MESH_EDIT_SPLIT,
  },
  {
    label: "交换",
    icon: "../../assets/exchange.svg",
    clickSignal: MeshEditSignal.MESH_EDIT_SWAP,
  },
  {
    label: "拉伸",
    icon: "",
    clickSignal: MeshEditSignal.MESH_EDIT_STRETCH,
  },
  {
    label: "扫掠",
    icon: "",
    clickSignal: MeshEditSignal.MESH_EDIT_SWEEP,
  },
];

// * 对应 网格检查
export const meshQualityMenu = [
  {
    label: "质量检查",
    icon: "",
    clickSignal: "MeshEdit_Quality",
  },
];
const prefix = "/cax-preprocess-web";
export const floatMenuConfig = [
  {
    key: 1,
    label: "显示网格对象",
    icon: prefix + "/icons/mesh_show_all.svg",
    clickSignal: FloatMenuSignal.MESH_SHOW_ALL,
  },
  {
    key: 2,
    label: "隐藏网格对象",
    icon: prefix + "/icons/mesh_hide_all.svg",
    clickSignal: FloatMenuSignal.MESH_HIDE_ALL,
  },
  {
    key: 3,
    label: "几何顶点选择",
    icon: prefix + "/icons/point_select.svg",
    clickSignal: FloatMenuSignal.GEO_POINT_MODE,
  },
  {
    key: 4,
    label: "几何轮廓线选择",
    icon: prefix + "/icons/geo_line_select.svg",
    clickSignal: FloatMenuSignal.GEO_LINE_MODE,
  },
  {
    key: 5,
    label: "几何面选择",
    icon: prefix + "/icons/geo_face_select.svg",
    clickSignal: FloatMenuSignal.GEO_FACE_MODE,
  },
  {
    key: 6,
    label: "网格点选择",
    icon: prefix + "/icons/mesh_point_select.svg",
    clickSignal: FloatMenuSignal.MESH_POINT_MODE,
  },
  {
    key: 7,
    label: "网格线选择",
    icon: prefix + "/icons/mesh_line_select.svg",
    clickSignal: FloatMenuSignal.MESH_LINE_MODE,
  },
  {
    key: 8,
    label: "网格面选择",
    icon: prefix + "/icons/mesh_cell_select.svg",
    clickSignal: FloatMenuSignal.MESH_CELL_MODE,
  },
  {
    key: 9,
    label: "显示面",
    icon: prefix + "/icons/face_mode.svg",
    clickSignal: FloatMenuSignal.VIEW_FACE_MODE,
  },
  {
    key: 10,
    label: "显示线框",
    icon: prefix + "/icons/line_mode.svg",
    clickSignal: FloatMenuSignal.VIEW_LINE_MODE,
  },
  {
    key: 11,
    label: "显示顶点",
    icon: prefix + "/icons/point_mode.svg",
    clickSignal: FloatMenuSignal.VIEW_POINT_MODE,
  },
];
